import time
import keras
import numpy as np
import pandas as pd
from PIL import Image
from keras.preprocessing.image import img_to_array

img = Image.open("./test.png").resize((28, 28))
t = img_to_array(img) #shape=(28,28,4)
x = 1.0-t[np.newaxis,:,:,:1]/255.0 # x=255-I shape=(1,28,28,1) 

model = keras.models.load_model("./mnist.h5")
y = model.predict(x)

t = pd.Series(y[0], index=['0', '1', '2','3','4','5','6','7','8','9'])
output = t.sort_values(ascending=False)[:3]

print(output)